package com.talos.ums.dal.mysql.organizationmanager;

import com.talos.framework.common.pojo.PageResult;
import com.talos.framework.mybatis.core.mapper.BaseMapperX;
import com.talos.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.talos.ums.controller.admin.organizationmanager.vo.UmsOrganizationManagerPageReqVO;
import com.talos.ums.dal.dataobject.organizationmanager.UmsOrganizationManagerDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 组织管理人员关联表 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface UmsOrganizationManagerMapper extends BaseMapperX<UmsOrganizationManagerDO> {

    default PageResult<UmsOrganizationManagerDO> selectPage(UmsOrganizationManagerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UmsOrganizationManagerDO>()
                .eqIfPresent(UmsOrganizationManagerDO::getUserId, reqVO.getUserId())
                .likeIfPresent(UmsOrganizationManagerDO::getUserName, reqVO.getUserName())
                .eqIfPresent(UmsOrganizationManagerDO::getOrgId, reqVO.getOrgId())
                .eqIfPresent(UmsOrganizationManagerDO::getCreatorCode, reqVO.getCreatorCode())
                .likeIfPresent(UmsOrganizationManagerDO::getCreatorName, reqVO.getCreatorName())
                .betweenIfPresent(UmsOrganizationManagerDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UmsOrganizationManagerDO::getModifierCode, reqVO.getModifierCode())
                .likeIfPresent(UmsOrganizationManagerDO::getModifierName, reqVO.getModifierName())
                .betweenIfPresent(UmsOrganizationManagerDO::getModifyTime, reqVO.getModifyTime())
                .eqIfPresent(UmsOrganizationManagerDO::getCreatorId, reqVO.getCreatorId())
                .eqIfPresent(UmsOrganizationManagerDO::getModifierId, reqVO.getModifierId())
                .eqIfPresent(UmsOrganizationManagerDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(UmsOrganizationManagerDO::getId));
    }

}
